<template>
	<view>
		<view class="container">
			<view class="title" style="background-color: #336799">基本信息</view>
			<view class="content">
				<view class="content-item">
					<text class="item-title"><text class="iconfont" style="color: #e64340;">&#xe62f;</text>姓名：</text>
					<text class="item-info">{{baseInfo.name}}</text>
				</view>
				<view class="content-item">
					<text class="item-title"><text class="iconfont" style="color: #0c24ff;">&#xe705;</text>性别：</text>
					<text class="item-info">{{baseInfo.gender}}</text>
				</view>
				<view class="content-item">
					<text class="item-title"><text class="iconfont" style="color: #81d7ff;">&#xe60b;</text>学院：</text>
					<text class="item-info">{{baseInfo.depart}}</text>
				</view>
				<view class="content-item">
					<text class="item-title"><text class="iconfont" style="color: #ff700a;">&#xe640;</text>地址：</text>
					<text class="item-info">{{baseInfo.address}}</text>
				</view>
				<view class="content-item">
					<text class="item-title"><text class="iconfont" style="color: #ff07e7;">&#xe66f;</text>电话：</text>
					<text class="item-info">{{baseInfo.tel}}</text>
				</view>
				<view class="content-item">
					<text class="item-title"><text class="iconfont" style="color: #d2e807;">&#xe62b;</text>邮箱：</text>
					<text class="item-info">{{baseInfo.email}}</text>
				</view>
				<view class="content-item">
					<text class="item-title"><text class="iconfont" style="color: #0bca15;">&#xe666;</text>职称：</text>
					<text class="item-info">{{baseInfo.professionalTitle}}</text>
				</view>
				<view class="content-item">
					<text class="item-title"><text class="iconfont" style="color: #4d17ff;">&#xe620;</text>研究方向：</text>
					<text class="item-info">{{baseInfo.researchArea}}</text>
				</view>
			</view>
		</view>

		<view class="container" v-if="recruitInfo.flag">
			<view class="title" style="background-color: #a47fe8">招生资格</view>
			<view class="content">
				<view class="content-item">
					<text class="item-title"><text class="iconfont" style="color: #e64340;">&#xe8ce;</text>论文数：</text>
					<text class="item-info">{{recruitInfo.paperNumber}}</text>
				</view>
				<view class="content-item">
					<text class="item-title"><text class="iconfont" style="color: #0c24ff;">&#xe62e;</text>专著数：</text>
					<text class="item-info">{{recruitInfo.treatiseNumber}}</text>
				</view>
				<view class="content-item">
					<text class="item-title"><text class="iconfont" style="color: #81d7ff;">&#xe7fc;</text>获奖数：</text>
					<text class="item-info">{{recruitInfo.awardNumber}}</text>
				</view>
				<view class="content-item">
					<text class="item-title"><text class="iconfont" style="color: #ff700a;">&#xe660;</text>专利数：</text>
					<text class="item-info">{{recruitInfo.patentNumber}}</text>
				</view>
				<view class="content-item">
					<text class="item-title"><text class="iconfont" style="color: #ff07e7;">&#xe6eb;</text>国家项目数：</text>
					<text class="item-info">{{recruitInfo.countryProjectNumber}}</text>
				</view>
				<view class="content-item">
					<text class="item-title"><text class="iconfont" style="color: #d2e807;">&#xe6eb;</text>国家立项数：</text>
					<text class="item-info">{{recruitInfo.countryProjectLeaderNumber}}</text>
				</view>
				<view class="content-item">
					<text class="item-title"><text class="iconfont" style="color: #b7b2ff;">&#xe6eb;</text>省级项目数：</text>
					<text class="item-info">{{recruitInfo.provinceProjectNumber}}</text>
				</view>
				<view class="content-item">
					<text class="item-title"><text class="iconfont" style="color: #0bca15;">&#xe6eb;</text>省级立项数：</text>
					<text class="item-info">{{recruitInfo.provinceProjectLeaderNumber}}</text>
				</view>
				<view class="content-item">
					<text class="item-title"><text class="iconfont" style="color: #4d17ff;">&#xe62f;</text>招生专业：</text>
					<text class="item-info">{{recruitInfo.major}}</text>
				</view>
			</view>
		</view>

		<view class="container">
			<view class="title" style="background-color: #8c97e7">发表论文</view>
			<view class="content" v-for="(item, index) in paperList" :key="index">
				<view class="content-item">
					<text class="item-title">[{{index+1}}]</text>
					<text class="item-info">{{item.name}}</text>
				</view>
			</view>
		</view>

		<view class="container">
			<view class="title" style="background-color: #e87f9e">发表专著</view>
			<view class="content" v-for="(item, index) in monographList" :key="index">
				<view class="content-item">
					<text class="item-title">[{{index+1}}]</text>
					<text class="item-info">{{item.name}}</text>
				</view>
			</view>
		</view>

		<view class="container">
			<view class="title" style="background-color: #e260ff">科研项目</view>
			<view class="content" v-for="(item, index) in projectList" :key="index">
				<view class="content-item">
					<text class="item-title">[{{index+1}}]</text>
					<text class="item-info">{{item.name}}
						<text class="item-title" v-if="item.tier==0">[国家级]</text>
						<text class="item-title" v-else>[省级]</text>
					</text>
					
				</view>
			</view>
		</view>

		<view class="container">
			<view class="title" style="background-color: #ff754e">获得奖励</view>
			<view class="content" v-for="(item, index) in awardList" :key="index">
				<view class="content-item">
					<text class="item-title">[{{index+1}}]</text>
					<text class="item-info">{{item.name}}</text>
				</view>
			</view>
		</view>

		<view class="container">
			<view class="title" style="background-color: #8c97e7">专利成果</view>
			<view class="content" v-for="(item, index) in patentList" :key="index">
				<view class="content-item">
					<text class="item-title">[{{index+1}}]</text>
					<text class="item-info">{{item.name}}</text>
				</view>
			</view>
		</view>


	</view>
</template>

<script>
	import * as pageRequest from '@/api/tHomePage.js';
	export default {
		data() {
			return {
				tid:'',
				baseInfo: {},
				paperList: [],
				monographList: [],
				projectList: [],
				awardList: [],
				patentList: [],
				recruitInfo: {
					flag: false
				}
			};
		},
		methods: {
			getData() {
				let target = 7
				uni.showLoading()
				// 基本信息
				pageRequest.getPersonInfo({
					id: this.tid
				}).then(res => {
					// console.log(res)
					this.baseInfo = res.data.data
					pageRequest.findPersonById({
						id: this.tid
					}).then(res => {
						// console.log(res)
						this.baseInfo = { ...this.baseInfo,
							...res.data.data
						}
						target--
						if (target == 0)
							uni.hideLoading()
					})
				})
				// 论文
				pageRequest.getPaperList({
					tid: this.tid
				}).then(res => {
					this.paperList = res.data.data
					target--
					if (target == 0)
						uni.hideLoading()
				})
				// 专著
				pageRequest.getTreatiseList({
					tid: this.tid
				}).then(res => {
					this.monographList = res.data.data
					target--
					if (target == 0)
						uni.hideLoading()
				})
				// 专利
				pageRequest.getPatentList({
					tid: this.tid
				}).then(res => {
					this.patentList = res.data.data
					target--
					if (target == 0)
						uni.hideLoading()
				})
				// 项目
				pageRequest.getProjectList({
					tid: this.tid
				}).then(res => {
					this.projectList = res.data.data
					target--
					if (target == 0)
						uni.hideLoading()
				})
				// 奖励
				pageRequest.getRewardList({
					tid: this.tid
				}).then(res => {
					this.awardList = res.data.data
					target--
					if (target == 0)
						uni.hideLoading()
				})
				// 招生资格
				pageRequest.recruitInfo({
					tid: this.tid
				}).then(res => {
					if (res.data.data) {
						this.recruitInfo = res.data.data
						this.recruitInfo.flag = true
					}
					target--
					if (target == 0)
						uni.hideLoading()
				})
			}
		},
		onLoad(option) {
			this.tid = option.tid
			this.getData()
		}
	};
</script>

<style>
	.container {
		padding: 10px 0 10px 10px;
		border-bottom: 1px solid #f2f2f2;
		margin-bottom: 10px;
		position: relative;
	}

	.title {
		font-family: 'Courier New', Courier, monospace;
		color: #FFFFFF;
		height: 60px;
		width: 60px;
		box-sizing: border-box;
		line-height: 20px;
		font-size: 20px;
		padding: 10px;
		position: absolute;
	}

	.content {
		background-color: #f8f8f8;
		margin-left: 10px;
		width: 280px;
		display: inline-block;
		border-radius: 5px;
		box-sizing: border-box;
		position: relative;
		left: 60px;
	}

	.content-item {
		padding: 10px;
	}

	.item-title {
		color: #a5a5a5;
		font-size: 18px;
		font-family: 'Courier New', Courier, monospace;
	}

	.item-info {
		font-family: '宋体';
		width: 70%;
	}

	.iconfont {
		font-family: "iconfont" !important;
		font-size: 18px;
		font-style: normal;
		-webkit-font-smoothing: antialiased;
		-moz-osx-font-smoothing: grayscale;
		margin-right: 5px;
	}
</style>
